Ext.define('App.datacollection.dctask.model.CollectionTaskViewModel', {
    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.CollectionTaskViewModel',
    requires: ['App.datacollection.dctask.model.CollectionTaskModel'],
    data: {
        columns: [{
            text: 'ID',
            dataIndex: 'id',
            hidden: true,
            sortable: false
        }, {
            text: '接口名称',
            dataIndex: 'name',
            sortable: true,
            flex: 1
        }, {
            text: '项目',
            dataIndex: 'projectId',
            sortable: true,
            flex: 3
        }, {
            text: '接口',
            dataIndex: 'collectionInterface',
            sortable: true,
            flex: 1,
            renderer: function (v) {
                return v.name
            }
        }, {
            text: '描述',
            dataIndex: 'description',
            sortable: true,
            flex: 3
        }],
        search: {
            fields: [{
                name: "接口名称",
                field: 'name',
                vtype: 's',
                defaultValue: '',
                opt: 'like',
                datas: null
            }, {
                name: "主机",
                field: 'host',
                vtype: 's',
                defaultValue: '',
                opt: 'like',
                datas: null
            }, {
                name: "URL",
                field: 'url',
                vtype: 's',
                defaultValue: '',
                opt: 'like',
                datas: null
            }, {
                name: "数据表",
                field: 'dataTable',
                vtype: 's',
                defaultValue: '',
                opt: 'like',
                datas: null
            }, {
                name: "数据字段",
                field: 'dataField',
                vtype: 's',
                defaultValue: '',
                opt: 'like',
                datas: null
            }]
        }
    },
    stores: {
        Query: {
            autoLoad: false,
            model: 'App.datacollection.dctask.model.CollectionTaskModel',
            pageSize: 25,
            remoteSort: true,
            proxy: {
                type: 'majax',
                url: 'collection/task/query_simple',
                reader: {
                    type: 'json',
                    rootProperty: 'data',
                    totalProperty: 'total'
                }
            }
        }
    }
});